[WIP] Persist resolutions and program information and reuse it when building program incrementally or during editor#41004
Closed
sheetalkamat wants to merge 49 commits intomainfrom
Closed
[WIP] Persist resolutions and program information and reuse it when building program incrementally or during editor#41004sheetalkamat wants to merge 49 commits intomainfrom
sheetalkamat wants to merge 49 commits intomainfrom
Conversation
cb79ae2 to
36d89be
Compare
2f726c1 to
18035fa
Compare
18035fa to
d05151a
Compare
aa893c3 to
7e761cd
Compare
073ed19 to
fb609c0
Compare
12ca63c to
abe3b73
Compare
a0e33af to
7c202bd
Compare
Member
|
This is a really interesting idea. What sorts of speed-ups/memory reduction savings have you seen on larger projects? |
…d to a file This ensure --watch and editor behaviour matches with what happens without watch and there is no confusion as well as we are not watching unnecessary things
… enabling persistResolutions)
…ect reference files in the program so editor can use correct program
95eeb32 to
f0db440
Compare
Contributor
|
Found this PR again after seeing it on the TypeScript 5.0 roadmap.
I think it'll be extremely significant. Back when I was investigating this for a large monorepo, I saw a 72.21% improvement in one of our team's packages. Details in #40964 Looking forward to some version of this in 5.0. Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds option
persistResolutionswhich perists the program and resolutions information into the tsbuildinfo file. This option is meant to also mean that if module is resolved to file, dont watch any of the failed lookup locations for those, and always use that file as resolved file unless that file is deleted. The unresolved modules are still resolved again to see if it can be resolved at time of program creation.This also adds option
cleanPersistedProgramto remove the persisted program information (without loosing incremental build information) which helps in creating program as if this option was not enabled. So if user changes location of where the resolution needs to be, they can use this option.The main changes are:
oldProgramasProgramFromBuildInfowhich is built from program information saved in tsbuildinfo. The stored information is partial information needed to make decisions about whether program structure can be completely reused or only module resolutions can be safely used or cannot reuse at all.persistResolutionsis true. Need to be stored with and without--outoption.oldProgramdiffer inuseSourceOfProjectReferenceRedirect, then structure cannot be reused and in case ofpersistentResolutionit means module resolution can be reused.Questions to answer :
persistResolutionsok. Given we do need to store more information than just resolutions but resolutions are the main things that determine the behavior of if they should be retained or not.cleanPersistedProgramnow useful. It was in the start because when i was experimenting , module name resolution whether failed or succeeded would be re-used so if you did npm install, you would want to run this command to clean up. Now that we still resolve failed lookups or if resolved file is deleted, things should flow more smoothly and just deleting tsbuildinfo file should be ok in that rare case.. The new behaviour works better with editing experience.cleanPersistedProgramoption. Will it be intuitive?cleanPersistedProgramoption to be run and then restart the tsserver to handle the the project updates?